package com.lcy.mybatis.generator.plugin.element;

import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.dom.java.Method;

/**
 * <p>创建时间：2017/5/4 16:59</p>
 *
 * @author 娄存银
 * @version 1.0
 */
public class TotalCountElement extends CustomerSqlElement{
    private static final String SQL = "select count(*) from %s";

    public TotalCountElement(IntrospectedTable table) {
        super(table);
    }

    @Override
    public void initXmlElement() {
        xmlElement = countElement();
    }

    @Override
    protected void initMethod() {
        method = new Method(getId());
        method.setReturnType(TYPE_INTEGER);
    }

    @Override
    protected String getId() {
        return "totalCount";
    }

    @Override
    protected String getSql() {
        return SQL;
    }
}
